﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="ThongKeHoaDon.aspx.cs" Inherits="Cart.ThongKeHoaDon" %>
<%@ Register Assembly="vdc_AJAXPage" Namespace="VdcInc" TagPrefix="vajax" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript" charset="utf-8">
        function fnChangeTrangThai(ddl, id) {
            var a = ddl.options[ddl.selectedIndex].value;
            ob_post.AddParam('strHoaDonid', id);
            ob_post.AddParam('strTrangThai', a);
            ob_post.post(null, "vThayDoiTrangThai", ResultThayDoiTrangThai);
        }
        function ResultThayDoiTrangThai(result, ex) {
            
                alert(result);
                window.location = "ThongKeHoaDon.aspx";
            
        }
        function XoaHoaDon(id) {
            var answer = confirm("Bạn có chắc muốn xóa ko ?")
            if (answer) {
                ob_post.AddParam('strHoaDonId', id);
                ob_post.post(null, "vXoaHoaDon", ResultXoaChiTiet);
            }
        }
        function ResultXoaChiTiet(result, ex) {
            alert(result);
            window.location = "ThongKeHoaDon.aspx";
        }
    </script>
    <div class="content_buy_cart">
        <div class="buy_cart_top">
        </div>

        <div class="buy_cart_content">
            <div class="profile_breadcrumbs">


                <ul>
                    <li>
                        <a class="" href="DanhSachSanPham.aspx" title="">Sản phẩm
                        </a>
                    </li>

                    <li>|
                    </li>

                    <li>
                        <a class="" href="Ds_LoaiSP.aspx" title="">Loại sản phẩm
                        </a>
                    </li>

                    <li>|
                    </li>

                    <li>
                        <a class="" href="DanhSachNguoiDung.aspx" title="">Người dùng
                        </a>
                    </li>
                    <li>|
                    </li>
                    <li>
                        <a class="active" href="ThongKeHoaDon.aspx" title="">Hóa đơn bán hàng
                        </a>
                    </li>
                </ul>

            </div>

            <!-- cart-detail-begin -->
            <p class="buy_cart_title">
                LỊCH SỬ MUA HÀNG CỦA BẠN
            </p>
            <asp:Repeater runat="server" ID="RptParent">
                <ItemTemplate>
                    <div class="buy_cart_content_title">
                        <span class="content_title_delete">STT</span>
                        <span class="content_title_product">Sản phẩm / Dịch vụ</span>
                        <span class="content_title_price">Đơn giá</span>
                        <span class="content_title_quanlity">Số lượng</span>
                        <span class="content_title_total">Thành tiền</span>
                    </div>
                    <table class="table_buy_cart_content table_my_order" border="0" cellpadding="0" cellspacing="0">
                        <tbody>
                            <asp:Repeater runat="server" ID="RptChild" DataSource='<%# ((Cart.HoaDonSrv.HoaDon)Container.DataItem).lstChiTiet.Select ( link => new {
                                                                                                    TrangThai = ((Cart.HoaDonSrv.HoaDon)Container.DataItem).TrangThai, 
                                                                                                    TongTien = ((Cart.HoaDonSrv.HoaDon)Container.DataItem).TongTien, 
                                                                                                    ThoiGian = ((Cart.HoaDonSrv.HoaDon)Container.DataItem).ThoiGian, 
                                                                                                    STT = link.STT,
                                                                                                    SanPhamTen = link.SanPhamTen,
                                                                                                    GiaTien = link.GiaTien,
                                                                                                    SoLuong = link.SoLuong,
                                                                                                    TongSo = link.SoLuong * link.GiaTien
                                                                                                    }) %>'>
                                <ItemTemplate>

                                    <tr id="cart_row_714_1214">
                                        <td class="cart_content_delete"><%# Eval("STT") %></td>
                                        <td class="cart_content_product"><%# Eval("SanPhamTen") %></td>
                                        <td class="cart_content_price"><%# Eval("GiaTien") %></td>
                                        <td class="cart_content_quanlity"><%# Eval("SoLuong") %></td>
                                        <td class="cart_content_total"><span id="product_714_1214"><%# Eval("TongSo") %></span></td>
                                    </tr>

                                </ItemTemplate>
                            </asp:Repeater>
                            <tr>
                                <td colspan="2" class="cart_content_status">Trạng thái: 
                                    <asp:DropDownList ID="ddlSoLuong" runat="server" DataSource='<%# AddDataSource() %>' DataTextField="Value" DataValueField="Key"
                                                SelectedValue='<%# Eval("TrangThai") %>' onchange='<%# Eval("Id","fnChangeTrangThai(this,{0})") %>'>
                                            </asp:DropDownList> </td>
                                <td colspan="2" class="cart_content_finish_title">Tổng tiền thanh toán</td>
                                <td class="cart_content_finish_number"><%# Eval("TongTien") %></td>
                            </tr>
                            <tr>
                                <td colspan="2" class="cart_content_code"></td>
                                <td colspan="2" class="cart_content_date">Ngày Mua: <%# Convert.ToDateTime(Eval("ThoiGian")).ToString("dd/MM/yyyy") %></td>
                                <td class="cart_content_cancle"><a class="delete" id="order_10861" href="#" onclick="XoaHoaDon('<%# Eval("Id") %>')" title=""></a></td>
                            </tr>
                        </tbody>
                    </table>
                    <p class="clear_line"></p>
                </ItemTemplate>
            </asp:Repeater>

            <!-- cart-detail-end -->

        </div>

        <div class="buy_cart_bottom">
        </div>
    </div>
    <vajax:CallbackPanel runat="server" ID="cbpTongTien">
                            <Content>
    <div id="ctl00_content_content_paging" class="content_paging">
        <ul>
            <li><b>Tổng doanh thu :&nbsp&nbsp&nbsp</b></li>
            <li>
                <label runat="server" id="lbTongDoanhThu"></label>
            </li>
        </ul>
    </div>
                                </Content>
        </vajax:CallbackPanel>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
</asp:Content>
